// import request from '@/utils/request'
import {
  request
} from "@/utils/request";
let userinfo = JSON.parse(sessionStorage.getItem('userInfo'))
let userId = ''
let organizationId = 0;
if (userinfo) {
  organizationId = userinfo.tenantId
  userId = userinfo.loginName
}
// 获取所有表头
export function getColumns(parameter = {}) {
  return request({
    url: '/deliver/Windchill/servlet/rest/hzero/pmgt/plan/getActivityHeaders',
    method: 'post',
    data: parameter,
  })
}
//获取展示的表头
export function getShowColumns(parameter = {}) {
  return request({
    url: `/indv/v1/${organizationId}/customize-headers?userId=${userId}`,
    method: 'get',
    params: parameter,
  })
}
//获取展示的数据
export function getShowSource(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/getTaskData`,
    method: 'post',
    data: parameter,
  })
}
//获取用户权限配置及活动属性配置
export function getUserConfig(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/getCurrentUserConfig`,
    method: 'post',
    data: parameter,
  })
}
//获取详情属性布局
export function getTaskDetail(parameter = {}) {
  return request({
    url: `/project/Windchill/servlet/rest/hzero/pdm/attribute/getAttributeGroup`,
    method: 'post',
    data: parameter,
  })
}
//获取关键节点名称
export function getKeyNodeName(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/getKeyNodeConfigs`,
    method: 'post',
    data: parameter,
  })
}
//获取交付物信息
export function getDeliverInfo(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/deliverable/getPlanDeliverabes`,
    method: 'post',
    data: parameter,
  })
}
//修改交付物信息
export function updateDeliverInfo(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/deliverable/updateDeliverabe`,
    method: 'post',
    data: parameter,
  })
}
//新建交付物信息
export function createDeliverInfo(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/deliverable/createPlanDeliverabe`,
    method: 'post',
    data: parameter,
  })
}
//移除交付物信息
export function deleteDeliverInfo(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/deliverable/deletePlanDeliverabes`,
    method: 'post',
    data: parameter,
  })
}
//得到文件夹结构树
export function getDocumentTree(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pdm/folder/getFolderTree`,
    method: 'post',
    data: parameter,
  })
}
//得到文件夹结构树
export function getFolderContents(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pdm/folder/getFolderContents`,
    method: 'post',
    data: parameter,
  })
}
//添加交付物
export function submitDeliverSubject(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/deliverable/updateDeliverabeSubject`,
    method: 'post',
    data: parameter,
  })
}
/**
 * hlu-edit
 */
export function publishPIPlanActivity(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/publishPIPlanActivity`,
    method: 'post',
    data: parameter,
  })
}
// 撤销发布任务
export function unPublishPIPlanActivity(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/unPublishPIPlanActivity`,
    method: 'post',
    data: parameter,
  })
}
//保存修改信息
export function saveUpdateInfo(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/savePIPlanActivities`,
    method: 'post',
    data: parameter,
  })
}
//删除节点
export function deleteNode(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/deletePIPlanActivities`,
    method: 'post',
    data: parameter,
  })
}
//本地上传交付物
export function uploadFromLocal(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/foundation/doc/createDoc`,
    method: 'post',
    data: parameter,
  })
}
//得到计划id
export function getPlanId(parameter = {}) {
  return request({
    url: `/project/Windchill/servlet/rest/hzero/pmgt/project/getPIPlans`,
    method: 'post',
    data: parameter,
  })
}
//重启问题
export function restartTask(parameter = {}) {
  return request({
    url: `/deliver/Windchill/servlet/rest/hzero/pmgt/plan/reopenTask`,
    method: 'post',
    data: parameter,
  })
}